#include <iostream>
#include <string>

using namespace std;

void MultiDimArray()
{
	int ia[3][4]; // array of size 3, eache element is an array of ints of size 4
	int (*ip)[4] = ia; // ip points to an array of 4 ints.
	ip = &ia[2]; // ia[2] is an array of 4 ints

	// array of pointers to int
	// int *ip2[4] = ia; // IntelliSense: initialization with '{...}' expected for aggregate object; Error	C2440: 'initializing' : cannot convert from 'int [3][4]' to 'int *[4]'

	int i = 5, j = 10;

	cout << (i < j ? i : j) << endl; // prints larger of i and j
	/* below expression equals to:
	cout << (i < j); // prints 1 or 0
	cout ? i : j; // test cout and then envaluate i or j
				  // depending on whether cout evaluates to true or false
	*/
	cout << (i < j) ? i : j; // prints 1 or 0
	// cout << (i < j) ? i : j << endl; //IntelliSense: cannot determine which instance of overloaded function "endl" is intended

	// cout << i < j ? i : j; // IntelliSense: no operator "<" matches these operands; Error C2679: binary '<' : no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversion)
	
	cout << endl << "sizeof Test: " << endl;
	int x[10]; int *p = x;
	cout << sizeof(x)/sizeof(*x) << endl;
	cout << sizeof(p)/sizeof(*p) << endl;
	
	switch(i){		
	case 1:
		break;
	case 2:
		break;
	case 3:
		break;
	default:
		break;

		int iiip = 0;
	}
}